package org.deyang.tools.amazon.utils;

import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

public class AmazonXMLProcessor {
	
	public static String getDefaultChildNodeValue(Element currentElement, String childTagName){
		if (currentElement != null){
			NodeList childNodeList = currentElement.getElementsByTagName(childTagName);
			if (childNodeList.getLength() > 0){
				return childNodeList.item(0).getTextContent();
			}else{
				return "";
			}
		}else{
			return "";
		}
		
		
	}
	
	
	public static Element getDefaultChildNode(Element currentElement, String childTagName){
		if (currentElement != null){
			NodeList childNodeList = currentElement.getElementsByTagName(childTagName);
			if (childNodeList.getLength() > 0){
				return (Element) childNodeList.item(0);
			}else{
				return null;
			}
		}else{
			return null;
		}
		
	}

}
